layui.use(['form', 'layer', 'jquery', 'laydate'],
    function () {
        $ = layui.jquery;
        var form = layui.form,
            layer = layui.layer;
        var laydate = layui.laydate;
        //监听提交
        form.on('submit(add)',
            function (data) {
                //定义存储复选框勾选的爱好内容
                // $("#navTitle").val(data.field.title);
                console.log(data.field);


                $.ajax({
                    url: 'http://localhost:8080/back/font/insertFoot',
                    data: JSON.stringify(data.field),
                    contentType:'application/json',
                    type: 'post',
                    headers:{'username':localStorage.getItem("loginUser")},
                    dataType:'json',
                    success: function (res) {
                        console.log("后端返回de数据", res)
                        if (res.data == "success") {
                            //发异步，把数据提交给php
                            layer.alert("增加成功", {
                                    icon: 6
                                },
                                function () {
                                    //关闭当前frame
                                    xadmin.close();

                                    // 可以对父窗口进行刷新
                                    xadmin.father_reload();
                                });
                        } else {
                            layer.alert("增加失败");
                        }
                    }
                })
                return false;
            });

    });